package com.yiwannuofulasi.oauth;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiwannuofulasi.oauth.entity.OauthClientDetails;
import com.yiwannuofulasi.oauth.gateway.OauthClientDetailsGateway;
import com.yiwannuofulasi.oauth.mapper.OauthClientDetailsMapper;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yiwannuofulasi
 * @description TODO
 * @date 2023/5/5 14:41
 * Copyright (c) 2023/5/5 by yiwannuofulasi yiwannuofulasi@163.com, by 新疆兵团勘测设计院（集团）有限公司 All Rights Reserved.
 */
@Component
public class OauthClientDetailsGatewayImpl implements OauthClientDetailsGateway {

    @Resource
    private OauthClientDetailsMapper oauthClientDetailsMapper;

    @Override
    public List<OauthModel> queryOauthByClientName(String clientName) {
        QueryWrapper<OauthClientDetails> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("client_name",clientName);
        List<OauthClientDetails> oauthClientDetails = oauthClientDetailsMapper.selectList(queryWrapper);
        return OauthClientDetailsGatewayMapstructMapper.INSTANCE.toOauthClientDetailsList(oauthClientDetails);
    }
}
